package com.glsc.ngateway.flowable.amqp;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class InitQueue {
    public static final String EXCHANGE = "flowable.exchange.default";
    public static final String EXCHANGE_CHECKGW = "flowable.exchange.checkGW";

    public static final String QUEUE = "flowable.queue.default";
    public static final String QUEUE_CHECKGW = "flowable.queue.checkGW";

    public static final String ROUTING_KEY = "flowable.queue.default";
    public static final String ROUTING_KEY_CHECKGW = "flowable.queue.checkGW";

    @Bean
    DirectExchange newExchange() {
        return new DirectExchange(EXCHANGE_CHECKGW);
    }

    @Bean
    Queue newQueue() {
        return new Queue(QUEUE_CHECKGW, true, false, false);
    }

    @Bean
    public Binding initBinding() {
        return BindingBuilder.bind(newQueue()).to(newExchange()).with(ROUTING_KEY_CHECKGW);
    }
}